package com.ahui.handler.file;


import com.ahui.constant.SupportedFileTypeConst;
import com.ahui.handler.FileHandler;
import com.ahui.handler.FileHandlerFactory;
import com.ahui.util.TifUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.io.File;
import java.util.List;

/**
 * @author qx.zhang@goupwith.com
 * @since 2023/4/25 16:37
 */

@Slf4j
@Component
public class TiffHandler implements FileHandler {


    @Override
    public void afterPropertiesSet() {
        FileHandlerFactory.register(SupportedFileTypeConst.TIFF, this);
        FileHandlerFactory.register(SupportedFileTypeConst.TIF, this);
    }

    @Override
    public List<String> handleFile(String filePath, String tempFolder) {
        List<String> files = TifUtil.tif2img(new File(filePath),tempFolder,"jpg");
//        Assert.(!files.isEmpty(), "TIFF文件切图失败！");
        return files;
    }
}
